package com.xy.annotaion.handler.kotlin.demo.demo1

import com.xy.annotaion.handler.kotlin.p

/**
 * You can edit, run, and share this code.
 * play.kotlinlang.org
 */

interface A {
    fun f() = println("A::f")
}

interface B {
    fun f() = println("B::f")
}

open class C : A, B {
    override fun f() {
        super<A>.f()
        super<B>.f()
    }
}

interface D {
    fun f() = println("D::f")
}

class E : D {

}

typealias F = C

class G : F()


sealed class F0

class F1 : F0()
class F2 : F0()
object F3 : F0() {
    fun f3() = p("object F3::f3")
}

interface Base {
    fun p()
}

class BaseImpl : Base {
    override fun p() = println("BaseImpl::P")
}

class Delegate : Base by BaseImpl() {
//     override fun p()=println("Delegate::p")
}

fun main() {
    val e = E()
    e.f()
    println("Hello, world!!!")
    val c = C()
    c.f()
    val f = F()
    f.f()

    val f3: F0 = F3


    when (f3) {
        is F1 -> println("F1")
        is F2 -> println("F2")
        F3 -> println("F3")
    }

    Delegate().p()

    p(f3 === F3)
    p(f3)

    if (f3 is F3) {
        f3.f3()
    }
    if (Delegate() is Base) {
        p("Delegate() is Base")
    }

}
